package com.ai.mapper.provider;

import com.ai.bo.InterViewerBo;
import com.ai.bo.InterviewRecordBO;
import org.apache.ibatis.jdbc.SQL;
import org.springframework.data.repository.query.Param;

public class InterviewRecordProvider {
    public String getInterviewRecordList(InterviewRecordBO interviewRecordBO){
        return new SQL(){{
            SELECT("i.id as interviewRecordId,i.candidate_id as candidateId,c.real_name as realName,c.identity_num as identityNum,c.mobile as mobile,c.sex as sex,i.create_time as createTime,i.job_name as jobName,i.take_time as takeTime");
            FROM("interview_record i left JOIN candidate c on i.candidate_id = c.id");
            if(interviewRecordBO.getRealName() != null && !interviewRecordBO.getRealName().trim().isEmpty()){
                WHERE("c.real_name LIKE CONCAT('%',#{realName},'%')");
            }
            if(interviewRecordBO.getMobile() != null && !interviewRecordBO.getMobile().trim().isEmpty()){
                WHERE("c.mobile LIKE CONCAT('%', #{mobile}, '%')");
            }
        }}.toString();
    }
}
